﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CodeGame.ServerObjects;

using Lidgren.Network;

namespace CodeGame.Networking.Serverside
{
    class ServerProtocolChat
    {
        public static void SendGlobalChat(Player sender, string message)
        {
            NetOutgoingMessage msg = DedicatedServer.CreateMessage(ServerClientNet.GlobalAnounce);
            msg.Write(sender.Nickname);
            msg.Write(message);
            DedicatedServer.SendMessage(msg);
        }

        public static void SendGlobalChat(string nick, string message)
        {
            NetOutgoingMessage msg = DedicatedServer.CreateMessage(ServerClientNet.GlobalAnounce);
            msg.Write(nick);
            msg.Write(message);
            DedicatedServer.SendMessage(msg);
        }

        public static void SendPrivateChat(string nick, string message, NetConnection target)
        {
            NetOutgoingMessage msg = DedicatedServer.CreateMessage(ServerClientNet.GlobalAnounce);
            msg.Write(nick);
            msg.Write(message);
            DedicatedServer.SendMessage(msg, target);
        }
    }
}
